<?php

/**
 * 加载类
 */

namespace Lib;

class Load
{

    /**
     * 加载Model类
     *
     * @staticvar array $arr_obj
     * @param string $name
     * @return object
     */
    public static function loadModel($name)
    {
        static $arrObj = array();
        $modelName = '\\App\\' . App_Name . '\\Model\\' . 'Model_' . $name;
        if (!isset($arr_obj[$modelName])) {
            $arrObj[$modelName] = new $modelName();
        }

        return $arrObj[$modelName];
    }

    /**
     * 加载Data类
     *
     * @staticvar array $arr_obj
     * @param string $name
     * @return object
     */
    public static function loadData($name)
    {
        static $arrObj = array();
        $dataName = '\\App\\' . App_Name . '\\Data\\' . 'Data_' . $name;
        if (!isset($arr_obj[$dataName])) {
            $arrObj[$dataName] = new $dataName();
        }

        return $arrObj[$dataName];
    }
}
